﻿using System;
using System.Collections.Generic;
using RRRSRoguelike.Helpers;
using RRRSRoguelike.Helpers.Visualizer;

namespace RRRSRoguelike.Screens
{
	/// <summary>
	/// Abstract implementation of a screen.
	/// </summary>
	public abstract class Screen
	{
		/// <summary>
		/// list of panels for the screen
		/// </summary>
		protected List<Panel> PanelList;
		/// <summary>
		/// is the screen active?
		/// </summary>
		protected Boolean active = true;

		/// <summary>
		/// should panels be drawn
		/// </summary>
		protected bool drawPanels = true;

		/// <summary>
		/// constructor
		/// </summary>
		public Screen()
		{
			PanelList = new List<Panel>();
		}

		/// <summary>
		/// Show screen
		/// </summary>
		public virtual void Show()
		{
			ConsoleSpecific.SetConsoleSize(Constants.ConsoleWidth,Constants.ConsoleHeight);
		}

		/// <summary>
		/// Clear screens and panels
		/// </summary>
		public void Clear()
		{
			ConsoleSpecific.Clear();
			foreach (var panel in PanelList)
				panel.Clear();
		}

		/// <summary>
		/// wraps console readkey
		/// </summary>
		public void WaitKey()
		{
			ConsoleSpecific.ReadKey(true);
		}
	}
}
